﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Model.Dto
{
    public class ResultData<T>
    {
        /// <summary>
        /// 错误编码 默认为0
        /// </summary>
        public string Code { get; set; } = "0";
        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrMsg { get; set; }
        /// <summary>
        /// 对象
        /// </summary>
        public Object Data { get; set; }
        /// <summary>
        /// 返回集合
        /// </summary>
        public List<T> ListData { get; set; }

        #region 构造方法
        /// <summary>
        /// 构造方法
        /// </summary>
        public ResultData()
        {
        }

        /// <summary>
        ///  构造方法
        /// </summary>
        /// <param name="Code">错误编码</param>
        public ResultData(string Code)
        {
            this.Code = Code;
        }
        /// <summary>
        ///  构造方法 返回错误编码、 错误信息
        /// </summary>
        /// <param name="Code">错误编码</param>
        /// <param name="ErrMsg">错误信息</param>
        public ResultData(string Code, string ErrMsg)
        {
            this.Code = Code;
            this.ErrMsg = ErrMsg;
        }
        /// <summary>
        ///  构造方法 返回错误编码、 错误信息、对象
        /// </summary>
        /// <param name="Code">错误编码</param>
        /// <param name="ErrMsg">错误信息</param>
        /// <param name="Data">对象</param>
        public ResultData(string Code, string ErrMsg, Object Data)
        {
            this.Code = Code;
            this.ErrMsg = ErrMsg;
            this.Data = Data;
        }
        /// <summary>
        ///   构造方法 返回错误编码、 错误信息、对象、返回集合
        /// </summary>
        /// <param name="Code">错误编码</param>
        /// <param name="ErrMsg">错误信息</param>
        /// <param name="Data">对象</param>
        /// <param name="ListData">返回集合</param>
        public ResultData(string Code, string ErrMsg, Object Data, List<T> ListData)
        {
            this.Code = Code;
            this.ErrMsg = ErrMsg;
            this.Data = Data;
            this.ListData = ListData;
        }
        #endregion

    }
}
